package com.yb.xczx.cloud.auth.config;

import com.yb.xczx.cache.manager.api.XczxStringCacheManager;
import com.yb.xczx.cloud.auth.generator.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/5/20 16:38
 * FileName: AppConfig
 * Description:
 */

@Configuration
public class AppConfig {

    @Autowired
    XczxStringCacheManager xczxStringCacheManager;

    @Bean
    XczxCodeGenerator xczxCodeGenerator(){
        ArrayList<XczxCodeGenerator> xczxCodeGenerators = new ArrayList<>();
        xczxCodeGenerators.add(new XczxLoginCodeGenerator(xczxStringCacheManager));
        xczxCodeGenerators.add(new XczxEmailCodeGenerator());
        xczxCodeGenerators.add(new XczxMobileCodeGenerator());

        XczxDelegateCodeGenerator delegateCodeGenerator = new XczxDelegateCodeGenerator(xczxCodeGenerators);
        return delegateCodeGenerator;
    }
}
